//
//  CLMemoryViewController.m
//  Charles
//
//  Created by Leo on 2017/5/24.
//  Copyright © 2017年 charles. All rights reserved.
//

#import "CLMemoryViewController.h"
#import "MRCTest.h"
#import "ARCTest.h"

@interface CLMemoryViewController ()

@end

@implementation CLMemoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //[self testMRC];
    [self testARC];
    [self testCopy];
}

- (void)testARC {
    ARCTest *arc = [[ARCTest alloc]initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 300)];
    [arc test];
    [self.view addSubview:arc];
}

- (void)testMRC {
    MRCTest *mrc = [[MRCTest alloc]initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 300)];
    [mrc test];
    [self.view addSubview:mrc];
}

- (void)testCopy {
    NSArray *array = [NSArray arrayWithObjects:@(1),@(2),nil];
    for (NSNumber *obj in array) {
        NSLog(@"内存地址是：%p",obj);
    }
    NSArray *copyArray = [array copy];
    for (NSNumber *obj in copyArray) {
        NSLog(@"内存地址是：%p",obj);
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
